package com.ruoyi.mdm.service.impl;

import com.ruoyi.mdm.domain.SkuEmailConfig;
import com.ruoyi.mdm.mapper.MonitorEmailConfigMapper;
import com.ruoyi.mdm.service.IMonitorEmailConfigService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 监控邮件配置 业务层处理
 * 
 * @author ruoyi
 */
@Service
public class MonitorEmailConfigServiceImpl implements IMonitorEmailConfigService
{
    private static final Logger log = LoggerFactory.getLogger(MonitorEmailConfigServiceImpl.class);

    @Autowired
    private MonitorEmailConfigMapper monitorEmailConfigMapper;

    /**
     * 根据条件分页查询监控邮件配置信息列表
     * 
     * @param monitorEmailConfig 监控邮件配置信息
     * @return 监控邮件配置集合信息
     */
    @Override
    public List<SkuEmailConfig> selectMonitorEmailConfigList(SkuEmailConfig monitorEmailConfig)
    {
        return monitorEmailConfigMapper.selectMonitorEmailConfigList(monitorEmailConfig);
    }

    /**
     * 通过监控邮件配置ID查询监控邮件配置信息
     *
     * @param emailConfigId 监控邮件配置ID
     * @return 监控邮件配置信息
     */
    @Override
    public SkuEmailConfig selectMonitorEmailConfigById(String emailConfigId)
    {
        return monitorEmailConfigMapper.selectMonitorEmailConfigById(emailConfigId);
    }

    /**
     * 新增监控邮件配置信息
     *
     * @param monitorEmailConfig 监控邮件配置信息
     * @return 结果
     */
    @Override
    public int insertMonitorEmailConfig(SkuEmailConfig monitorEmailConfig)
    {
        // 新增监控邮件配置信息
        int rows = monitorEmailConfigMapper.insertMonitorEmailConfig(monitorEmailConfig);

        return rows;
    }

    /**
     * 通过邮件地址配置查询 监控邮件配置信息
     *
     * @param userName  邮件地址
     * @return  监控邮件配置信息
     */
    @Override
    public SkuEmailConfig selectMonitorEmailConfigByUserName(String userName) {
        return monitorEmailConfigMapper.selectMonitorEmailConfigByUserName(userName);
    }

    @Override
    public List<SkuEmailConfig> selectMonitorEmailConfigListByEmailType(String emailType) {
        return monitorEmailConfigMapper.selectMonitorEmailConfigListByEmailType(emailType);
    }
}
